//
//  UIImageView+Extension.m
//  YYBG_IOS
//
//  Created by wyl on 2017/5/30.
//  Copyright © 2017年 wyl. All rights reserved.
//

#import "UIImageView+Extension.h"
#import "UIColor+Extension.h"
@implementation UIImageView (Extension)


-(void)addLabelToTop:(BOOL)isNeed{
    if (isNeed) {
        if (![self viewWithTag:101]) {
            UILabel *topLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 34, 14)];
            topLabel.text = @"十元";
            topLabel.textAlignment =NSTextAlignmentCenter ;
            topLabel.font = [UIFont systemFontOfSize:12];
            topLabel.textColor =[UIColor whiteColor];
            topLabel.tag = 101 ;
            topLabel.hidden = NO ;
            topLabel.backgroundColor = [UIColor colorWithHexString:@"#40E0D0"];
            [self addSubview:topLabel];
        }else {
            UILabel *topLabel = [self viewWithTag:101] ;
            topLabel.hidden =NO ;
        }
    }else {
        if ([self viewWithTag:101]) {
            UILabel *topLabel = [self viewWithTag:101];
            topLabel.hidden = YES ;
            [topLabel removeFromSuperview];
        }
    }
  

}
@end
